<?php require('includes/header.php'); ?>
<?php require('includes/nav.php'); ?>
	
	<!-- creating a div for the page -->
	<div style="width:100%; text-align:center; margin:10px; font-size:150%;">
		<a href="/runningrecords/index.php/record/addroute">Add a route</a>
	</div>
	
	<!--creating a table for the data to be displayed -->
	<table class="list">
		
		<tr>
			<th>
				Name
			</th>
			
			<th>
				Miles / Kilometers
			</th>
			
			<th>
				Description
			</th>
			
			<th>
				Delete
			</th>
		</tr>
		
			<?php 
				//fetching data from database to be put into table
				foreach($result as $r_key => $r_val)
				{
					for($i = 0; $i < count($r_val); $i++)
					{
							echo "<form action=\"/runningrecords/index.php/record/deleteroute\" method=\"post\"><p><input type=\"hidden\" name=\"routeID\" value=\"" . $r_val->routeID . "\" /></p>";
							echo "<tr>";
							echo "<td>" . $r_val->name  . "</td>";
							echo "<td>" . $r_val->miles . " / " . $r_val->kilometers . "</td>";
							echo "<td>" . $r_val->description  . "</td>";
							echo "<td><button type=\"submit\" style=\"background-color:#900; color:#fff; padding:5px;\">Delete</button></td>";
							echo "</tr></form>";
					}
				}
			?>
		</tr>
	</table>
	
<?php require('includes/footer.php'); ?>